﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ET.Score.Service;
using ET.Score.Service.Interfaces;
using ET.CommonLibrary.Wcf;
using ET.Score.Service.Dtos;
using System.Collections.ObjectModel;
using ET.Score.Service.Enums;
//using ET.Score.Framework;
using ET.DBCommon.Model;
using System.ServiceModel;

namespace ET.ScoreTeacherClient.ServiceProviders
{
    public class AccountServiceHelper
    {
        private Lazy<WcfClient<IAccountManageService>> helper =
           new Lazy<WcfClient<IAccountManageService>>(() =>
               WcfClient.Create<IAccountManageService>("AccountManageService"));

        private static AccountServiceHelper instance = new AccountServiceHelper();
        public ObservableCollection<ClientTypeDto> GetClientTypesbyUserId(int userid)
        {
            //  return helper.Value.RequestService(service => service.GetClientTypesbyUserId(userid));
            return null;
        }
        public int GetData()
        {
            return 0;
            //  return helper.Value.RequestService(service => service.GetData());
        }
        public static AccountServiceHelper Instance
        {
            get { return instance; }
        }

        public LoginMessage Login(WxUserLoginInfoDto dto)
        {
            try
            {
                //  return helper.Value.RequestService(service =>service.Login(dto));
                return null;
            }
            catch (Exception ex)
            {
                return null;
            }
        }


        public LoginMessage Login(PcUserLoginInfoDto userinfo)
        {
            try
            {
                //return helper.Value.RequestService( service =>service.Login(userinfo));
                return null;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        /// <summary>
        /// 从在线用户列表中移除该用户
        /// </summary>
        /// <param name="userName">退出帐号的账户名</param>
        public void LoginOut(string userName)
        {

           // helper.Value.RequestService( service => service.LoginOut(userName));
        }

        /// <summary>
        /// 向服务端周期性发送用户存活状态
        /// </summary>
        /// <param name="userId"></param>
        public void LoginStatus(string userName)
        {
            try
            {
               // helper.Value.RequestService(  service => service.LoginStatus(userName));
            }
            catch (Exception ex)
            {
                //LogHelper.WriteError(typeof(AccountServiceHelper), "LoginStatus:" + ex.Message);
                throw (ex);
            }
        }
        /// <summary>
        /// 将指定账户和微信账户绑定
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns
        LoginMessage WxUserBind(WxUserBindingDto dto)
        {
            // return helper.Value.RequestService( service =>service.WxUserBind(dto));
            return null;
        }

        public ObservableCollection<UserInformation> GetUserList(int roleid)
        {
            try
            {
                // return helper.Value.RequestService( service => service.GetUserList(roleid));
                return null;
            }
            catch
            {
                return null;
            }
        }

        /// <summary>
        /// 返回登录状态
        /// </summary>
        /// <param name="clientMacIp">客户端mac 地址</param>
        /// <param name="clientOperId">客户端程序类型</param>
        /// <returns>找不到用户时返回空</returns>
        public UserInformation GetLoginState(List<string> clientMacIp, LoginType clientOperId)
        {
            // return helper.Value.RequestService(  service =>service.GetLoginState(clientMacIp, clientOperId));
            return null;
        }
        /// <summary>
        /// 根据客户端类型查找目前在线的用户
        /// </summary>
        /// <param name="ClientOperId"></param>
        /// <returns></returns>

        public ObservableCollection<PcUserLoginInfoDto> GetLoginUserList(LoginType ClientOperId)
        {
            try
            {
                //return helper.Value.RequestService( service =>service.GetLoginUserListByType(ClientOperId));
                return null;
            }
            catch (Exception ex)
            {
                //LogHelper.WriteError(typeof(AccountServiceHelper), "GetLoginUserList:" + ex.Message);
                return null;
            }
        }

        public ObservableCollection<PcUserLoginInfoDto> GetLoginUserList()
        {
            try
            {
                return null;
               // return helper.Value.RequestService(service =>service.GetLoginUserList());
            }
            catch (Exception ex)
            {
                //LogHelper.WriteError(typeof(AccountServiceHelper), "GetLoginUserList:" + ex.Message);
                return null;
            }
        }


        public void SetCurrentTestPaper(int userId, int examresultId)
        {
           // helper.Value.RequestService(service => service.SetCurrentTestPaper(userId, examresultId));
        }

        public UserInfoModel GetCurrentUserInfo()
        {
            // return helper.Value.RequestService(service => service.GetCurrentUserInfo());
            return null;
        }

        public DateTime GetVirtualTime()
        {
            // return helper.Value.RequestService(service => service.GetVirtualTime());
            return DateTime.Now;
        }

        public ExamResultsModel GetCurrentExamResult()
        {
            //return helper.Value.RequestService(service => service.GetCurrentExamResult());
            return null;
        }

        public Tuple<int, string> GetGetCurrentTask()
        {
            //return helper.Value.RequestService(service => service.GetGetCurrentTask());
            return null;
        }

        public void CorrectSkip(int stepId)
        {
           // helper.Value.RequestService(service => service.CorrectSkip(stepId));
        }

        public void ErrorSkip(int stepId)
        {
           // helper.Value.RequestService(service => service.ErrorSkip(stepId));
        }

        public void UserLogout()
        {
          //  helper.Value.RequestService(service => service.OutLoginUser());
        }

        public void Submit(List<string> times, bool isStopScene = false, string stopExplain = "")
        {
           // helper.Value.RequestService(service => service.Submit(times, isStopScene, stopExplain));
        }

        public void SceneDeductPoints(int examQuestionId, string deductPointsExplain, decimal score)
        {
           // helper.Value.RequestService(service => service.SceneDeductPoints(examQuestionId, deductPointsExplain, score));
        }

        public List<EventRecordModel> GetEventRecords()
        {
            // return helper.Value.RequestService(service => service.GetEventRecords());
            return null;
        }

        public void MainTaskSkip(int taskId)
        {
            // helper.Value.RequestService(service => service.MainTaskSkip(taskId));
        }
		
		public void SetMyWaitFlag()
        {
          //  helper.Value.RequestService(service => service.SetMyWaitFlag());
        }

        public bool UpdateTestPaper()
        {
            //  return helper.Value.RequestService(service => service.UpdateTestPaper());
            return false;
        }
        /// <summary>
        /// 设置是否更新试卷
        /// </summary>
        public void SetUpdateTestPaper()
        {
            // helper.Value.RequestService(service => service.SetUpdateTestPaper());
        }
        /// <summary>
        /// 设置考核培训模式
        /// </summary>
        public void Set_TrainModel(byte ExamModel)
        {
            // helper.Value.RequestService(service => service.Set_TrainModel(ExamModel));
        }
        /// <summary>
        /// 获取考核培训模式
        /// </summary>
        //public byte Get_TrainModel()
        //{
        //    // return helper.Value.RequestService(service => service.Get_TrainModel());
        //}
        /// <summary>
        /// 选手结束比赛或者培训
        /// </summary>
        public void TerminateExamination()
        {
           // helper.Value.RequestService(service => service.TerminateExamination());
        }

        public void ClearCurrentExam()
        {
            //helper.Value.RequestService(service => service.ClearCurrentExam());
        }
    }
}
